package com.cman777.springc.common.helper;

import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
import com.cman777.springc.common.bean.Iface.ResultCodeEnumI;
import com.cman777.springc.common.bean.exception.BusinessException;

/**
 * @author chenzhicong
 * @time 2020/3/18 3:25
 * @description
 */
public class ValidateUtil {

    /**
     * 验证 boolean 是否为 true,不为true则抛出业务异常
     */
    public static void isTrue(boolean expression, String code, String message) {
        if (!expression) {
           throw new BusinessException(code,message);
        }
    }
    /**
     * 验证 boolean 是否为 true,不为true则抛出业务异常
     */
    public static void isTrue(boolean expression, ResultCodeEnumI enumI) {
        if (!expression) {
            throw new BusinessException(enumI);
        }
    }






}
